package runTime;

import TAProgram.IR;
import util.GraphUtil;

public class DrawGraph {

    public static void draw(GraphUtil graphUtil){
        IR.use.clear();
        for(var block : IR.basicBlocks){
            if(IR.use.get(block) == null) {
                graphUtil.node(block.getName(),block.toString());
                IR.use.put(block,true);
            }
            var blocks = block.getNextBlocks();
            if(blocks != null && blocks.size() > 0){
                for(var next : blocks){
                    graphUtil.link(block.getName(),next.getName());
                }
            }
        }
    }

}
